package com.zyz.D_方法.练习;

/**
 * @author: vick
 * @Date: 2025/3/13
 * @Description:
 * @version: 1.0
 */
public class Demo3 {
    public static void main(String[] args) {
        Demo3 demo1 = new Demo3();
        int[] nums = {1, 3, 5, 7, 9};
        int num = demo1.findMax(nums);
        System.out.println(num);
    }

    public int findMax(int[] nums) {
       int max = nums[0];
        for (int num : nums) {
            if (num > max) {
                max = num;
            }
        }
        return max;
    }
}
